<?php
include "includes/comunes.php";
if (!function_exists('json_encode')) {
	require_once 'json/jsonwrapper_inner.php';
}



$array = array();
if ($_GET['_name'] == 'provincia')
{

	 if ( $_GET['_value'] == 0 )//usa
	 {
		$array[] = array('0' => 'Sin valores');
		
	  } else
	  {
              $sqlplanes="select * from localidades where idProvincia=".$_GET['_value'];
              $respla=cons_ins($sqlplanes);
              while ($regcli=mysql_fetch_array($respla)){
              $array[] = array($regcli['id'] => utf8_encode($regcli['Nombre']));
             
              }

	  }
}
//elseif ($_GET['_name'] == 'localidad')
//{
//	 if ( $_GET['_value'] == 0 )//New York
//	 {
//		$array[] = array('0' => 'Sin valores');
//	  } else
//	  {
//              $sqlplanes="select * from localidades where idProvincia=".$_GET['_value'];
//              $respla=cons_ins($sqlplanes);
//              while (!$respla->EOF){
//              $array[] = array($respla->fields['id'] => utf8_encode($respla->fields['Nombre']));
//              $respla->MoveNext();
//              }
//	}
//}
else
{
	$array[] = array('1' => 'Data 1');
	$array[] = array('2' => 'Data 2');	
	$array[] = array('3' => 'Data 3');	
}
echo json_encode( $array );
?>
